<template>
  <div class="app-container">

    <!--<el-tag style="margin-bottom:20px;">-->
    <!--<a href="https://github.com/PanJiaChen/vue-element-admin/tree/master/src/components/TreeTable" target="_blank">Documentation</a>-->
    <!--</el-tag>-->

    <tree-table :data="data" :columns="columns" border/>

  </div>
</template>

<script>
/**
 Auth: Lei.j1ang
 Created: 2018/1/19-14:54
 */
import treeTable from '@/components/TreeTable'
import { getCategoryList } from '@/api/classes'

export default {
  name: 'Category',
  components: { treeTable },
  data() {
    return {
      columns: [
        {
          text: 'ID',
          value: 'id',
          width: 200
        },
        {
          text: '名称',
          value: 'name'
        },
        {
          text: 'PID',
          value: 'parent_id'
        },
        {
          text: '状态',
          value: 'is_delete'
        },
        {
          text: '时间',
          value: 'created_at'
        }
      ],
      data: []
    }
  },
  mounted: function() {
    this.getList()
  },
  methods: {
    getList() {
      getCategoryList(1).then((res) => {
        this.data = res.data
        console.log(res.data)
      }).catch((err) => {
        console.log(err)
      })
    }
  }
}
</script>
